package com.guoran100.adphoto.presenter.implement;

import android.app.Activity;
import android.support.annotation.NonNull;
import android.util.Log;

import com.alibaba.fastjson.JSONObject;
import com.guoran100.adphoto.display.activity.PlayActivity;
import com.guoran100.adphoto.display.view.IPlayView;
import com.guoran100.adphoto.presenter.contract.IPlayPresenter;

import java.util.List;

import biz.yfsoft.api.ae.api.AEClient;
import biz.yfsoft.api.ae.api.BaseAECallback;


/**
 * Created by caomenglong on 16/8/5.
 */
public class PlayPresenter implements IPlayPresenter {
    private String TAG="PlayPresenter";
    private final PlayActivity mActivity;
    private final IPlayView mPlayView;

    public PlayPresenter(@NonNull PlayActivity activity, @NonNull IPlayView cartView) {
        this.mActivity = activity;
        this.mPlayView = cartView;
    }

    @Override
    public void getPhotosList() {
        AEClient _client = new AEClient("ec.weistore.shopPoster");
        _client.call(new BaseAECallback() {
            @Override
            public void onStart() {
            }

            @Override
            public void onSuccess(List<JSONObject> result) {
                //Log.d(TAG,result.toString());
                mActivity.getPhotosListOk(result);
            }

            @Override
            public void onError( String errno, String message) {
                Log.e(TAG,"onFailure ......." + errno);
            }

            @Override
            public void onFinally(String s) {

            }
        });
    }
}
